package com.chinapost.util;

import java.io.Writer;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.components.Component;

import com.opensymphony.xwork2.util.ValueStack;

public class PermissionComponent extends Component {

	private String url;
	private AuthUtil authUtil;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public PermissionComponent(ValueStack stack, HttpServletRequest request) {
		super(stack);
		authUtil = new AuthUtil(request.getSession());
	}

	@Override
	public boolean start(Writer writer) {
		return authUtil.isAuth(url);
	}

}
